package bpui.views;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

import bpui.views.NavigationView.ObjectType;

public class NavigationViewLabelProvider extends LabelProvider {

	public String getText(Object obj) {
		return obj.toString();
	}
	public Image getImage(Object obj) {
		
		String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
		if (obj instanceof TreeParent) {
			if (((TreeParent)obj).getType() == ObjectType.PROCESS) {
				imageKey = ISharedImages.IMG_OBJ_FOLDER;
			} else {
				return ((TreeObject)obj).getImage();
			}
		} else if (obj instanceof TreeObject) {
			return ((TreeObject)obj).getImage();
		}
		return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
	}
}